1 Download R

2 Download RStudio

  • R Studio is an integrated development environment, built upon the base R
  • Download RStudio


3 Open RStudio

3.1 Install library packages needed for wordcloud app

  1. In RStudio console window type the following commands one-at-a-time, followed by the key (the > prompt will appear when process is complete):
  • install.packages(“shiny”)
  • install.packages(“tm”)
  • install.packages(“wordcloud”)
  • install.packages(“memoise”)
Image Caption: Install packages

Image Caption: Install packages



4 Use Wordcloud app

4.1 Open 3 RShiny app files in RStudio:

  • global.R
  • ui.R
  • server.R
Image Caption: Open files

Image Caption: Open files


Image Caption: Opened files

Image Caption: Opened files



4.2 Run the Shiny App

4.2.1 click Run App button

  • located at top right corner of code window
Image Caption: Click Run App button

Image Caption: Click Run App button

  • Running app shows ‘Processing corpus’ at bottom of screen
    Image Caption: Run app

    Image Caption: Run app


4.2.1.1 Console running messages

  • text will also be running in RStudio Console window as it is processed
    including some warnings that all words will not fit on page
    and will not be plotted (if too many words)
    Image Caption: Processing messages in console window

    Image Caption: Processing messages in console window


4.2.2 Waiting for the finished wordcloud

Image Caption: Finished Wordcloud

Image Caption: Finished Wordcloud


4.2.3 Finished wordcloud results

Image Caption: Finished Wordcloud

Image Caption: Finished Wordcloud


4.2.3.1 Waiting for maximum word count (7000) takes some time to run

Image Caption: Waiting for maximum word count

Image Caption: Waiting for maximum word count


4.2.4 Maximum words 7000

Image Caption: Maximum words 7000

Image Caption: Maximum words 7000


4.2.5 Maximum words 235 makes a smaller word cloud

Image Caption: Maximum words 235

Image Caption: Maximum words 235


4.3 Choose a different text from drop-down options

Image Caption: Choose a different text

Image Caption: Choose a different text


4.4 Click change text button

Image Caption: 'Change text button'

Image Caption: ‘Change text button’



5 Open Shiny app in a browser window

Image Caption: Open Shiny app in browser

Image Caption: Open Shiny app in browser


6 Save word cloud image to computer as .png

  • Right-click word cloud image to find save options
  • (Note: this image is from a MacOS)
    Image Caption: Right-click to save image to computer

    Image Caption: Right-click to save image to computer


Image Caption: Save image to computer

Image Caption: Save image to computer


Image Caption: Rename image file

Image Caption: Rename image file



7 Customize app

7.1 Change sliders for frequency and maximum words

  • Frequency: is the number of times a word appears in document
  • Max words: the larger this value is, the longer the process takes, more words will be included in word cloud, though will still be limited by plot window size
    Image Caption: Change Sliders

    Image Caption: Change Sliders


7.2 Add a different text file to the global.R file

  1. For ease the first time adding new text to analyze, relevant text can just be added and saved to the newtext.txt file
  2. To upload a new text file, the file name must be added to the global.R file
    following the same format as previous entries:
    2.1. the first term shows in drop-down choice box,
    2.2. the second term is the name of the file which must be included in same folder as all app files
    2.3. note that text is enclosed with quotation marks, and each line must end with a comma except the last line
Image Caption: Add new text files

Image Caption: Add new text files


7.3 Add words to exclude from text analysis to the global.R file

  • add word list, each separated by commas
    Image Caption: List of words to exclude

    Image Caption: List of words to exclude


7.4 Change default values for slider input in ui.R file

Image Caption: Changing default values

Image Caption: Changing default values



8 Source:

  • If difficulties or problems arise from the use of this tutorial, please contact Wendy Anthony for clarification … also, I would appreciate any feedback on how helpful this tutorial might be, or what might make it better

  • This app was adapted from the original app http://www.baoruidata.com/examples/082-word-cloud/
    by Author: Fereshteh Karimeddini

  • This tutorial document was created using the RMarkdown library